<%-- 
    Document   : FormTerimaPesanan
    Created on : Nov 19, 2013, 5:16:27 PM
    Author     : agung
--%>

<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Form Terima Pesanan</title>
        <link href="css/screen.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
       <div id="container"><center> <img src="gambar/handshaking.jpg" width="1350" height="300"></center>
            
                <% session = request.getSession(false);
                    String n = (String) session.getAttribute("uname");
                    if (n != null) {
                        out.print("Anda login sebagai " + n);
                    } else {
                        out.print("Session belum ada");
                    }
                %> 
            <div id="navigation">
                <ul>
                    <li><a href="HomeAdmin.jsp">Home</a></li>
                    <li><a href="FormTerimaBarang.jsp">Terima Barang</a></li>
                    <li><a href="FormLihatBarang.jsp">Lihat Barang</a></li>
                    <li><a href="FormKirimBarang.jsp">Kirim Barang</a></li>
                    <li><a href="FormKonfirmasiPengiriman.jsp">Konfirmasi Pengiriman</a></li>
                    <li><a href="Logout.jsp">Logout</a></li>
                </ul>
            </div>
            <div id="content">

                <form id="FLihatBarang" name="FLihatBarang" action="FormLihatBarang.jsp" > 
                    <h1>Lihat Barang</h1>   
                    <label>Nama Barang </label> : <input name="namaBarang" type="text" id="namaBarang" size="20" maxlength="20" class="txt" /><br/><br/>   
                    <div id="tombol">
                        <input name="btnLihat" type="submit" value="Lihat" class="button" />
                        <input name="btnReset" type="reset" value="Reset" class="button" />
                    </div> 
                </form> 

                <br><br><br><br><br>

                
                    <%
                        String namaBarang = request.getParameter("namaBarang");
                    %>
                    <%
                        try {
                            Connection con = KoneksiDB.Koneksi.open();
                            Statement stat = con.createStatement();
                            String cek = "select * from BARANG where nama_barang='" + namaBarang + "'";
                            ResultSet res = stat.executeQuery(cek);
                    %>
                    <table border="1">
                        <tr  width="10" bgcolor="#94A985">
                            <td>Tanggal Masuk</td>
                            <td>Kode Pemesanan</td>
                            <td>Nama Barang</td>
                            <td>Harga</td>
                            <td>Jumlah</td>
                        </tr>
                        <%
                            while (res.next()) {
                        %>
                        <tr>
                            <td><%=res.getString("tanggal_masuk")%></td>
                            <td><%=res.getString("kode_penerimaan")%></td>
                            <td><%=res.getString("nama_barang")%></td>
                            <td><%=res.getString("harga")%></td>
                            <td><%=res.getString("jumlah")%></td>
                        </tr>
                        <%   }%>
                    </table>
                    <%
                            res.close();
                            stat.close();
                            con.close();
                        } catch (Exception ex) {
                            out.println("Can't connect to database.");
                        }%>
                
            </div> 
            <div id="footer"> Copyright © Sistem Informasi Distributor Indomaret, 2013 </div> 
        </div> 
    </body> 
</html>
